package session09;

import javax.swing.*;
import java.awt.*;

public class ATMFrame extends JFrame {
    private IndexPanel index;
    private LoginPanel login;
    private RegisterPanel registerPanel;
    private SelectPanel selectPanel;
    private QueryPanel queryPanel;
    private SavePanel savePanel;
    private TakePanel takePanel;
    private ModifyPanel modifyPanel;
    private Container contentP;

    public Container getContentP() {
        return contentP;
    }

    public void setContentP(Container contentP) {
        this.contentP = contentP;
    }

    public IndexPanel getIndex() {
        return index;
    }

    public void setIndex(IndexPanel index) {
        this.index = index;
    }

    public LoginPanel getLogin() {
        return login;
    }

    public void setLogin(LoginPanel login) {
        this.login = login;
    }

    public RegisterPanel getRegisterPanel() {
        return registerPanel;
    }

    public void setRegisterPanel(RegisterPanel registerPanel) {
        this.registerPanel = registerPanel;
    }

    public SelectPanel getSelectPanel() {
        return selectPanel;
    }

    public void setSelectPanel(SelectPanel selectPanel) {
        this.selectPanel = selectPanel;
    }

    public QueryPanel getQueryPanel() {
        return queryPanel;
    }

    public void setQueryPanel(QueryPanel queryPanel) {
        this.queryPanel = queryPanel;
    }

    public SavePanel getSavePanel() {
        return savePanel;
    }

    public void setSavePanel(SavePanel savePanel) {
        this.savePanel = savePanel;
    }

    public TakePanel getTakePanel() {
        return takePanel;
    }

    public void setTakePanel(TakePanel takePanel) {
        this.takePanel = takePanel;
    }

    public ModifyPanel getModifyPanel() {
        return modifyPanel;
    }

    public void setModifyPanel(ModifyPanel modifyPanel) {
        this.modifyPanel = modifyPanel;
    }

    public ATMFrame() {
        this.setTitle("中国银行ATM机");
        this.setSize(1024, 768);

        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
        this.setLocationRelativeTo(null);//传另一个容器就相对于另一个容器，传null就相对于屏幕
        this.setResizable(false);//设置窗体大小不可变

        this.addContent();

        this.setVisible(true);
    }

    private void addContent() {
        this.contentP = this.getContentPane();
        this.setLayout(new CardLayout());

        //首页
        this.index = new IndexPanel(this);
        this.contentP.add("index", index);

        //登陆
        this.login = new LoginPanel(this);
        this.contentP.add("login", login);

        //注册
        this.registerPanel = new RegisterPanel(this);
        this.contentP.add("register", registerPanel);

        //选择
        this.selectPanel = new SelectPanel(this);
        this.contentP.add("select", selectPanel);

        //查询
        this.queryPanel = new QueryPanel(this);
        this.contentP.add("query", queryPanel);

        //存钱
        this.savePanel = new SavePanel(this);
        this.contentP.add("save", savePanel);

        //取钱
        this.takePanel = new TakePanel(this);
        this.contentP.add("take", takePanel);

        //修改密码
        this.modifyPanel = new ModifyPanel(this);
        this.contentP.add("modify", modifyPanel);
    }
}
